package o;

import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import androidx.annotation.NonNull;
import BaseDialog.a;
import o.dky.j;

public class dye extends dxx {
    private static final String TAG = "RootChecker";
    private static boolean rootedTipConfirmed;
    private BaseAlertDialog dialog;

    class b implements OnCancelListener {
        final /* synthetic */ dye ˎ;

        private b(dye o_dye) {
            this.ˎ = o_dye;
        }

        public void onCancel(DialogInterface dialogInterface) {
            dye.rootedTipConfirmed = false;
            this.ˎ.checkFailed();
        }
    }

    public dye(@NonNull Context context) {
        this.context = context;
    }

    public String getName() {
        return TAG;
    }

    public void doCheck() {
        if (rootedTipConfirmed || !etp.ˋ()) {
            checkSuccess();
            return;
        }
        Logger.ˏ(TAG, "phone OS was rooted, show dailog to confirm");
        showOSRootedTipDialog();
    }

    private void showOSRootedTipDialog() {
        this.dialog = BaseAlertDialog.ˋ(this.context, this.context.getString(j.ॱ), this.context.getString(j.ʻˋ));
        this.dialog.ॱ();
        this.dialog.ॱ(a.CONFIRM, this.context.getString(j.ﹳ));
        this.dialog.ॱ(a.CANCEL, this.context.getString(j.ꞌ));
        this.dialog.ˎ(new cks(this) {
            final /* synthetic */ dye ˋ;

            {
                this.ˋ = r1;
            }

            public void enableNetworking() {
                dye.rootedTipConfirmed = true;
                this.ˋ.checkSuccess();
            }

            public void upgrade() {
                dye.rootedTipConfirmed = false;
                this.ˋ.checkFailed();
            }

            public void ˋ() {
            }
        });
        this.dialog.ˊ(new b());
    }

    public void onDestroy() {
        super.onDestroy();
        try {
            if (this.dialog != null && this.dialog.ˎ()) {
                this.dialog.ˏ();
            }
        } catch (Exception e) {
            Logger.ˋ(TAG, "onDestroy dialog dismiss error");
        }
    }
}
